package com.reservoir.file.controller;

import com.reservoir.core.entity.RestMsg;
import com.reservoir.file.service.FileService;
import com.reservoir.file.service.Impl.MinioFileServiceImpl;
import io.minio.MinioClient;
import io.minio.UploadObjectArgs;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author xxx
 * @create 2021-11-04
 */
@RestController
@RequestMapping("/file")
@Api(tags = "文件接口")
public class FileController {
    @Autowired
    private FileService fileService;

    @PostMapping("/upload")
    @ApiOperation(value = "文件上传")
    public Object upLoad(@RequestParam(value = "file") MultipartFile file){
        try {
            return fileService.upLoadFile(file);
        } catch (Exception e) {
            e.printStackTrace();
            return RestMsg.fail();
        }
    }
}
